"""
【客户端】
"""
import socket

"""

"""
# 创建socket对象
socket_client = socket.socket()
# 连接服务器，IP和端口
socket_client.connect(('localhost', 8888))
while True:
    #     发送消息
    msg = input(f"你要发送的消息是：")
    if msg == "exit":
        break
    socket_client.send(msg.encode('utf-8'))
    #     接收消息
    recv_data = socket_client.recv(1024)
    print(f"你接收到的消息是：{recv_data.decode('utf-8')}")

socket_client.close()
